
import { loadPlanCourseJoinListToStu, loadCultivateSchemeByStu, loadCultivatePlanByStu } from "../../../services/trainingProgram"
export default {

  namespace: 'selectedCoursesModule',

  state: {
    list: "",
    course: ""
  },

  effects: {
    *getInfo({ payload }, { call, put }) {
      let { objData } = yield loadCultivateSchemeByStu()
      let { data } = yield loadCultivatePlanByStu()
      // let data = yield getTrainingCourse({schemeId:objData.id})
      yield put({
        type: "setCourse",
        payload: { ...objData, ...data}
      })
      let { rows } = yield loadPlanCourseJoinListToStu(payload)
      yield put({
        type: "setList",
        payload: rows
      })
      
    },
  },

  reducers: {
    setList(state, { payload }) {
      state.list = payload
      return { ...state, ...payload };
    },
    setCourse(state, { payload }) {
      state.course = payload
      return { ...state, ...payload };
    },
  },

};
